package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.PrefectureGoods;
import com.micro.modual.model.bo.prefecturegoods.PrefectureGoodsBO;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <h1>专区商品表 延展类</h1>
 *
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:26
 */
public class PrefectureGoodsExtension {

    public static List<PrefectureGoods> convertAddPrefectureGoods(PrefectureGoodsBO prefectureGoodsBO) {
        List<PrefectureGoods> prefectureGoodsList = new ArrayList<>();
        if(CollectionUtils.isNotEmpty(prefectureGoodsBO.getPrefectureGoodsList())){
            for(PrefectureGoodsBO.Goods goods:prefectureGoodsBO.getPrefectureGoodsList()){
                PrefectureGoods prefectureGoods = new PrefectureGoods();
                prefectureGoods.setId(SnowFlakeUtil.getId());
                prefectureGoods.setGoodsStatus(goods.getGoodsStatus());
                prefectureGoods.setCreateTime(new Date());
                prefectureGoods.setGoodsName(goods.getGoodsName());
                prefectureGoods.setGoodsSkuCode(goods.getGoodsSkuCode());
                prefectureGoods.setGoodsSort(goods.getGoodsSort());
                prefectureGoods.setIsMeddle(goods.getIsMeddle());
                prefectureGoods.setPrefectureCode(prefectureGoodsBO.getPrefectureCode());
                prefectureGoodsList.add(prefectureGoods);
            }
        }
        return prefectureGoodsList;
    }

}
